[string]$exchangeFilter = "Name='Microsoft Exchange Server'"

$getApps = Get-CimInstance -ClassName win32_Product -Filter $exchangeFilter | Select Name,Version
if (!$?) {
    return 
}
[string]$getApps.Version